package com.jwgf.queueprogramflash;

import java.util.List;
import java.util.concurrent.Callable;

public class StartEraseCallable implements Callable<List<Integer>> {
    private List<Integer> eraseSpindles;

    public StartEraseCallable(List<Integer> eraseSpindles) {
        this.eraseSpindles = eraseSpindles;
    }

    @Override
    public List<Integer> call() throws Exception {
        for (Integer spindle : eraseSpindles) {
            byte[] cmd = FlashCommand.createEraseFlash(spindle, FlashManager.getInstance().getPageCnt());
            FlashManager.getInstance().send(cmd);
        }
        try {
            Thread.sleep(11 * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return FlashManager.getInstance().getEchoSpindles();
    }
}
